package com.service;

import com.utils.FileUtils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 * Created by lyh on 2017/7/17.
 */
public class HelloImpl extends UnicastRemoteObject implements IHello {
    public  HelloImpl() throws RemoteException {
    }

    @Override
    public String sayHello() throws RemoteException {
        return "hello world";
    }

    @Override
    public String sayHelloToSomebody(String name) throws RemoteException {
        return   name+ "， 您好！";
    }

    @Override
    public byte[] getFileBytes(String filepath) throws  RemoteException {
        try {
            return FileUtils.readFromFilePathReStream(filepath);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
